/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sismol.cartography;

import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;

/**
 * Entidade que guarda o valor da tempo médio de um Trecho.
 *
 * @author koji
 */
@Entity
public class TempoMedio implements Serializable {

    private static final long serialVersionUID = 1L;

    private Long id;

    private Trecho trecho;

    private Long tempoMedio;
    private Long somaTotal;

    private DiaSemana diaDaSemana;
    private Integer horario;
    private Extras extra;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public DiaSemana getDiaDaSemana() {
        return diaDaSemana;
    }

    public void setDiaDaSemana(DiaSemana diaDaSemana) {
        this.diaDaSemana = diaDaSemana;
    }

    public Integer getHorario() {
        return horario;
    }

    public void setHorario(Integer horario) {
        this.horario = horario;
    }
    
    public Extras getExtra() {
        return extra;
    }

    public void setExtra(Extras extra) {
        this.extra = extra;
    }
    
    @ManyToOne
    public Trecho getTrecho() {
        return trecho;
    }

    public void setTrecho(Trecho trecho) {
        this.trecho = trecho;
    }

    public Long getSomaTotal() {
        return somaTotal;
    }

    public void setSomaTotal(Long somaTotal) {
        this.somaTotal = somaTotal;
    }

    public Long getTempoMedio() {
        return tempoMedio;
    }

    public void setTempoMedio(Long tempoMedio) {
        this.tempoMedio = tempoMedio;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TempoMedio)) {
            return false;
        }
        TempoMedio other = (TempoMedio) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "sismol.cartography.VelocidadePonderada[id=" + id + "]";
    }

}
